package com.aipsi.cws.auto.interceptor;

import com.appium.manager.element.anno.PageElement;
import com.appium.manager.element.anno.interceptor.PageInterceptor;
import com.appium.manager.template.AnnoAppiumHybridTemplate;
import lombok.extern.slf4j.Slf4j;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

/**
 * @author 大忽悠
 * @create 2022/7/8 17:22
 */
@Slf4j
public class IntoSupplierPageInterceptor implements PageInterceptor {
    @FindBy(css = "#tab-button-tab5")
    private WebElement meButton;
    @FindBy(xpath = "/html/body/app-root/ion-app/ion-router-outlet/app-tabs/ion-tabs/div/ion-router-outlet/app-tab5/ion-content/ion-grid/ion-row[1]/ion-col[3]")
    private WebElement supplierIcon;


    public void doInvoke(PageElement pageElement, AnnoAppiumHybridTemplate appiumHybridTemplate) throws InterruptedException {
        log.info("点击我的");
        pageElement.waitWhile();
        meButton.click();
        pageElement.waitWhile();
        log.info("点击供应商图标");
        supplierIcon.click();
        pageElement.waitWhile();
    }
}
